package com.share.rules.controller;

import com.share.common.core.domain.R;
import com.share.common.core.web.controller.BaseController;
import com.share.rule.domain.FeeRule;
import com.share.rules.service.IFeeRuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 费用规则Controller
 *
 * @author atguigu
 * @date 2024-10-25
 */
@Tag(name = "费用规则接口管理")
@RestController
@RequestMapping("/feeRule")
public class FeeRuleController extends BaseController {
    @Autowired
    private IFeeRuleService feeRuleService;

    //批量获取规则数据列表
    @Operation(summary = "批量获取费用规则信息")
    @PostMapping(value = "/getFeeRuleList")
    public R<List<FeeRule>> getFeeRuleList(@RequestBody List<Long> feeRuleIds) {
        List<FeeRule> feeRuleList = feeRuleService.listByIds(feeRuleIds);
        return R.ok(feeRuleList);
    }

    //根据id获取规则详情
    @Operation(summary = "获取费用规则详细信息")
    @GetMapping(value = "/getFeeRule/{id}")
    public R<FeeRule> getFeeRule(@PathVariable Long id) {
        FeeRule feeRule = feeRuleService.getById(id);
        return R.ok(feeRule);
    }

}

